﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Events - Event Handling</title>
    <script src="script/jquery-1.3.2.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            $("#btn").bind("click", function() {
                alert("Hello jQuery");
            });

            $("div").bind("dblclick", changeBG);

            $("#tombol").bind("click", { foo: "bar" }, handler);
        });

        function changeBG() {
            $("div").toggleClass("redBG");
        }

        function handler(event) {
            alert(event.data.foo);
        } 
    </script>
    <style type="text/css">
    div
    {
        border:dashed 1px #000;
        padding:13px;
        margin:13px;
    }
    
    .redBG
    {
        background-color:Red;
    }
    </style>
</head>
<body>
    <input id="btn" type="button" value="Show Alert Box" />
    <div>
        click me!
    </div>
    <input id="tombol" type="button" value="Show Data" />
</body>
</html>
